import json
def print_like_num():
    like_num = input("What's your favorite number：")
    filename = 'like_num.json'
    with open(filename,'w') as f:
        json.dump(like_num,f)

def get_like_num():
    filename = 'like_num.json'
    try:
        with open(filename) as f:
            likenum = json.load(f)
    except FileNotFoundError:
        return None
    else:
        print(f"I know your favorite number! it's {likenum}")
        return likenum

print_like_num()
get_like_num()